09. Log Messages
Log Messages
Logging is the process of recording messages to describe events that have occurred while running your software. Let's take a look at a few examples, and learn tips for writing good log messages.
Tip: Be professional and clear
Bad: Hmmm... this isn't working???
Bad: idk.... :(
Good: Couldn't parse file.
Tip: Be concise and use normal capitalization
Bad: Start Product Recommendation Process
Bad: We have completed the steps necessary and will now proceed with the recommendation process for the records in our product database.
Good: Generating product recommendations.
Tip: Choose the appropriate level for logging
DEBUG - level you would use for anything that happens in the program.
ERROR - level to record any error that occurs
INFO - level to record all actions that are user-driven or system specific, such as regularly scheduled operations
Tip: Provide any useful information
Bad: Failed to read location data
Good: Failed to read location data: store_id 8324971